package org.lai.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.lai.mapper.LogMapper;
import org.lai.pojo.OperateLog;
import org.lai.pojo.PageResult;
import org.lai.service.LogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class LogServiceImpl implements LogService {
    @Autowired
    private LogMapper logMapper;
    @Override
    public PageResult getLogList(Integer page, Integer pageSize) {
        // 调用PageHelper插件
        PageHelper.startPage(page,pageSize);
        // 获取数据
        List<OperateLog> logList =  logMapper.getLogList();
        // 封装数据
        Page<OperateLog> result = (Page<OperateLog>)logList;
        return new PageResult<>(result.getTotal(),result.getResult());
    }
}
